package com.crh.mapper;

import com.crh.bean.Users;
import org.apache.ibatis.jdbc.SQL;

/**
 * @author Chrui
 * @date 2018/10/22__14:52
 */
public class TestMapperSql {
    public String selectAllUsers() {
        return new SQL() {
            {SELECT("*").FROM("T_USERS");}
        }.toString();
    }

    public String selectUsersByCondition(final Users users) {
        return new SQL() {
            {
                SELECT("*").FROM("T_USERS");
                if (users != null) {
                    if (users.getUserId() != null)
                        WHERE("USERID=#{userId}");
                }
            }
        }.toString();
    }
}
